#converts a 2-nested list to a MATLAB matrix
def list2Mat(data):
    result = "["
    for v in data:
        for x in v:
            result += str(x) + ","
        result += ";"
    result += "]"
    return result

def dict2Struct(data):
    result = "struct("
    for k, v in data.items():
        result += "'" + k + "',"
        result += list2Mat(v)
        result += ","
    result = result[:-1] + ")"
    return result

